include ./Makefile.param

# target
TARGET := sample_virvi2opencv2vo

# target source
SRC := sample_virvi2opencv2vo.cpp mpp_vo.cpp

# header
INC := -I.\
	-I/usr/include/mpp/system/include \
	-I/usr/include/mpp/middleware/include \
	-I/usr/include/mpp/middleware/include/utils \
	-I/usr/include/mpp/middleware/include/media \
	-I/usr/include/mpp/middleware/media/include \
	-I/usr/include/mpp/middleware/media/include/utils \
	-I/usr/include/mpp/middleware/media/include/component \
	-I/usr/include/mpp/middleware/media/LIBRARY/libisp/include \
	-I/usr/include/mpp/middleware/media/LIBRARY/libisp/include/V4l2Camera \
	-I/usr/include/mpp/middleware/media/LIBRARY/libisp/isp_tuning \
	-I/usr/include/mpp/middleware/media/LIBRARY/libcedarc/include \
	-I/usr/include/mpp/middleware/media/LIBRARY/libcedarx/libcore/common/iniparser \
	-I/usr/include/mpp/middleware/sample/configfileparser \
	-I/usr/include/opencv4 \
	-I/usr/include/opencv4/opencv2

# share libraries
LIBS := \
	-lopencv_core \
	-lopencv_imgproc \
	-lopencv_imgcodecs \
	-llog \
	-lvencoder \
	-lsample_confparser \
	-lmpp_vi \
	-lmpp_isp \
	-lmpp_ise \
	-lmpp_vo \
	-lmpp_component \
	-lmedia_mpp \
	-lISP \
	-lMemAdapter \
	-lmedia_utils

LIBS_PATH := -L /usr/lib/opencv4

CFLAGS += $(INC) $(LIBS_PATH)

OBJS := $(SRC:%.cpp=%.o)

.PHONY: all
all: $(OBJS) $(TARGET)

%.o: %.cpp
	@$(if $(strip $(Q)), echo '  CC    $@')
	$(Q)$(CC) $(CFLAGS) -c -o $@ $<

$(TARGET): $(OBJS)
	@$(if $(strip $(Q)), echo '  LD    $@')
	$(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) $(LIBS_PATH) -o $@
	@$(if $(strip $(Q)), echo '  STRIP $@')
	$(Q)$(STRIP) $@

.PHONY: clean
clean:
	-rm -f $(TARGET) $(OBJS)
